version: '3'
services:
  flask:
    image: scriptoxin/flaskapp:1.0
    expose:
      - '5000'
    deploy:
      replicas: 3
    networks:
      loadbalancing:
        aliases:
          - flaskapp

  nginx:
    image: nginx:latest
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - ./key.pem:/root/ssl/key.pem
      - ./cert.pem:/root/ssl/cert.pem
    ports:
      - '5000:443'
    networks:
      - loadbalancing
    depends_on:
      - flask

networks:
  loadbalancing:
    driver: bridge
